<?php if ($this->userland->logged_in()): ?>
<div class="new_comment">
	<form action="/bricabox/<?php echo $bricabox->id; ?>/save_comment" method="post" onsubmit="return checkComment(<?php echo $inst->id; ?>);">
		<input type="hidden" name="username" value="<?php echo $this->userland->current_user()->login; ?>" />
		<input type="hidden" name="comment[user_id]" value="<?php echo $this->userland->current_user()->id; ?>" />
		<input type="hidden" name="comment[content_id]" value="<?php echo $content->id; ?>" />
		<fieldset>
			<div>
				<label for="comment_text_<?php echo $inst->id; ?>">You say:</label><br />
				<textarea name="comment[text]" id="comment_text_<?php echo $inst->id; ?>" rows="8" cols="50"></textarea>
			</div>
			
			<div class="controls">
				<input type="submit" value="Post comment" />
			</div>
		</fieldset>
	</form>
	
	<script type="text/javascript" charset="utf-8">
		function checkComment(id)
		{
			var el = $('#comment_text_'+id);
			if (el.val() == "")
			{
				alert('Whoops. You forgot to type a comment.');
				el.focus();
				return false;
			}
		}
	</script>
</div>
<?php else: ?>
<p><a href="/sign_up_or_log_in">Sign up or log in</a> to post a comment.</p>
<?php endif; ?>

<?php $is_homepage = false; require '_comments.php'; ?>